package com.mazaiting.redeye.api

import com.mazaiting.redeye.base.Config
import com.mazaiting.redeye.bean.ResponseDetectImageResultBean
import com.mazaiting.redeye.bean.RequestFaceImageBean
import com.mazaiting.redeye.bean.ResponseFaceTokenBean
import io.reactivex.Observable
import retrofit2.http.Body
import retrofit2.http.POST
import retrofit2.http.Query
import com.mazaiting.redeye.bean.Request as Request

/***
 *
 *
 *                                                    __----~~~~~~~~~~~------___
 *                                   .  .   ~~//====......          __--~ ~~
 *                   -.            \_|//     |||\\  ~~~~~~::::... /~
 *                ___-==_       _-~o~  \/    |||  \\            _/~~-
 *        __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
 *    _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
 *  .~       .~       |   \\ -_    /  /-   /   ||      \   /
 * /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
 * |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
 *          '         ~-|      /|    |-~\~~       __--~~
 *                      |-~~-_/ |    |   ~\_   _-~            /\
 *                           /  \     \__   \/~                \__
 *                       _--~ _/ | .-~~____--~-/                  ~~==.
 *                      ((->/~   '.|||' -_|    ~~-/ ,              . _||
 *                                 -_     ~\      ~~---l__i__i__i--~~_/
 *                                 _-~-__   ~)  \--______________--~~
 *                               //.-~~~-~_--~- |-------~~~~~~~~
 *                                      //.-~~~--\
 *                               神兽保佑
 *                              代码无BUG!
 * @author mazaiting
 * @date 2019-07-08
 * @description 图虫偏好服务
 */
interface FaceApiService {

    /**
     * 获取访问 Token
     * @param grantType 允许类型
     * @param clientId 客户 ID
     * @param clientSecret 客户密钥
     */
    @POST(Config.URL_FACE_TOKEN)
    fun getAccessToken(
        @Query("grant_type") grantType: String,
        @Query("client_id") clientId: String,
        @Query("client_secret") clientSecret: String
        ): Observable<ResponseFaceTokenBean>

    /**
     * 人脸检测
     * @param accessToken 访问 Token
     * @param faceImage 脸部图片信息
     */
    @POST(Config.URL_FACE_DETECT)
    fun detect(
        @Query("access_token") accessToken: String,
        @Body faceImage: RequestFaceImageBean
    ): Observable<ResponseDetectImageResultBean>
}